package com.springboot.blog.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.springboot.blog.entity.Article;
import com.springboot.blog.entity.vo.ArticleVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 文章表 Mapper 接口
 * </p>
 *
 * @author 4vsy
 * @since 2020-06-29
 */
public interface ArticleMapper extends BaseMapper<Article> {
    String querySql = "select article.*,category.title as name from article left join category on article.category_id=category.id ";
    String wrapperSql = "SELECT * from ( " + querySql + " ) AS q ${ew.customSqlSegment}";

    /**
     * 分页查询
     */
    @Select(wrapperSql)
    Page<ArticleVO> pageVO(Page<ArticleVO> page, @Param("ew") Wrapper<ArticleVO> queryWrapper);


    ArticleVO selectWithOther(@Param("id") Integer id);
}
